﻿<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="TelaCadastroClientes.aspx.cs" Inherits="DMA.SGDB.Web.TelaCadastroClientes"  %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <%@ Register TagPrefix="ucpnlQuestion" TagName="question" Src="~/Shared/UserControl/PainelYesNoUserControl.ascx" %>
    <%@ Register TagPrefix="ucpnlError" TagName="errors" Src="~/Shared/UserControl/PainelErrosUserControl.ascx" %>
    <%@ Register TagPrefix="ucNumericTextBox" TagName="numeric" Src="~/Shared/UserControl/NumericTextBoxUserControl.ascx" %>

    <script type="text/javascript" language="javascript">
        function isNumberKey(evt) {
            var charCode = (evt.which) ? evt.which : event.keyCode
            if (charCode > 31 && (charCode < 48 || charCode > 57))
                return false;

            return true;
        }
</script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">     
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" >
        <ContentTemplate>            
            <ucpnlError:errors  runat="server" ID="pnlErros"/>
            <ucpnlQuestion:question runat="server" ID="pnlQuestion"></ucpnlQuestion:question> 
            
            <div class="toolbarContanneir">
                <div id="divBtnNew" class="Toolbarbutton" runat="server">
                    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Imagens/Adicionar.png" ToolTip="Adicionar Cliente" OnClick="imgBtnNew_Click" />
                </div>
                <div id="divBtnSave" class="Toolbarbutton" runat="server">
                    <asp:ImageButton ID="imgBtnSave" runat="server" ImageUrl="~/Imagens/Salvar.png" OnClick="imgBtnSave_Click" ToolTip="Salvar" />
                </div>
                <div id="divBtnCancel" class="Toolbarbutton" runat="server">
                    <asp:ImageButton ID="imgBtnCancel" runat="server" ImageUrl="~/Imagens/Cancelar.png" OnClick="imgBtnCancel_Click" ToolTip="Cancelar" />
                </div>
                <div id="divBtnBack" class="Toolbarbutton" runat="server" visible="false" >
                    <asp:ImageButton ID="imgBtnBack" runat="server" ImageUrl="~/Imagens/Back.png" OnClick="imgBtnCancel_Click" Visible="true" ToolTip="Voltar" />
                </div>
            </div> 
              
            <asp:Panel ID="pnlOptions" runat="server">
                <div style="margin-top:10px"><asp:Label ID="lblTituloOptions" runat="server" Text="Cadastro de Clientes:"></asp:Label></div>
                <div style="margin-top:10px"><asp:LinkButton ID="lbtPessoaFisica" runat="server" onclick="lbtPessoaFisica_Click">Pessoa Física</asp:LinkButton></div>
                <div><asp:LinkButton ID="lbtPessoaJuridica" runat="server" onclick="lbtPessoaJuridica_Click">Pessoa Jurídica</asp:LinkButton></div>
            </asp:Panel>
            <asp:Panel ID="pnlList" runat="server" Visible="false">
                <div class="grupo" style="margin-top:5px">
                    <asp:GridView ID="gvList" runat="server" class="CustomGrid" Width="820px" CellPadding="4" ForeColor="#333333" EnableSortingAndPagingCallbacks="True" 
                        AllowPaging="True" AllowSorting="True" onpageindexchanging="gvList_PageIndexChanging" onsorting="gvList_Sorting">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:TemplateField>
                                <HeaderTemplate>
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <div style="width:100px; margin:2px">
                                        <asp:ImageButton ID="imgBtnEdit" runat="server" ImageUrl="~/Imagens/Alterar.gif"
                                            OnClick="imgBtnEdit_Click" ToolTip="Editar Configurações" />
                                        <asp:ImageButton ID="imgBtnDelete" runat="server" ImageUrl="~/Imagens/DeleteGrid.png"
                                            OnClick="imgBtnDelete_Click" ToolTip="Excluir Cadastro" />
                                        <asp:ImageButton ID="imgBtnVisualize" runat="server" ImageUrl="~/Imagens/ViewGrid.png"
                                            OnClick="imgBtnVisualize_Click" ToolTip="Visualizar Configurações" />                                       
                                    </div>
                                </ItemTemplate>
                                <ControlStyle Width="20px" />
                            </asp:TemplateField>
                        </Columns>
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" 
                            HorizontalAlign="Center" />
                        <PagerSettings Mode="NumericFirstLast" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" 
                            Font-Size="Large" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                    <div style="margin-top:15px"><asp:LinkButton ID="lbtBack" runat="server" onclick="lbtBack_Click">Voltar</asp:LinkButton></div> 
                </div>
            </asp:Panel>
            <asp:Panel ID="pnlRegister" runat="server" visible="false"> 
                <div style="font-size:16px; font-weight:bold; padding-bottom:10px; margin-top:5px"><asp:Label ID="lblTitle" runat="server" Text="Cadastro de Clientes"></asp:Label></div>    
                <div style="padding-bottom:10px;"><asp:CheckBox ID="chkVIP" runat="server" Text=" Cliente Gold" /></div>
                <div>
                    <table runat="server">            
                        <tr>
                            <td>
                                <asp:Label ID="lblClientOption" runat="server" Text="Cliente:"></asp:Label>
                            </td>
                            <td>
                                <asp:RadioButton ID="rdbPessoaFisica" runat="server" Text="Pessoa Física" AutoPostBack="true" Checked="true" oncheckedchanged="rdbPessoaFisica_CheckedChanged" />
                                <asp:RadioButton ID="rdbPessoaJuridica" runat="server" Text="Pessoa Jurídica" AutoPostBack="true" oncheckedchanged="rdbPessoaJuridica_CheckedChanged" />
                            </td>                
                        </tr>
                        <tr id="nome">
                            <td>
                                <asp:Label ID="lblName" runat="server" Text="Nome:"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtName" runat="server" MaxLength="45"></asp:TextBox>
                            </td>
                        </tr>
                        <tr id="razaoSocial">
                            <td>
                                <asp:Label ID="lblRazaoSocial" runat="server" Text="Razão Social:"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtRazaoSocial" runat="server" MaxLength="45"></asp:TextBox>
                            </td>
                        </tr>
                        <tr id="nomeFantasia">
                            <td>
                                <asp:Label ID="lblNomeFantasia" runat="server" Text="Nome Fantasia:"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtNomeFantasia" runat="server" MaxLength="45"></asp:TextBox>
                            </td>
                        </tr>
                        <tr id="cpf">
                            <td>
                                <asp:Label ID="lblCPF" runat="server" Text="CPF:"></asp:Label>
                            </td>
                            <td> 
                                <ucNumericTextBox:numeric ID="txtCPF" runat="server" MaxLength="11" Onkeypress="return isNumberKey(event)"/>                                                                                             
                            </td>
                        </tr>
                        <tr id="cnpj">
                            <td>
                                <asp:Label ID="lblCNPJ" runat="server" Text="CNPJ:"></asp:Label>
                            </td>
                            <td>
                                <ucNumericTextBox:numeric ID="txtCNPJ" runat="server" MaxLength="14" Onkeypress="return isNumberKey(event)"/>   
                            </td>
                        </tr>
                        <tr id="data">
                            <td>
                                <asp:Label ID="lblData" runat="server" Text="Data de Nascimento:"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtData" runat="server" MaxLength="10"></asp:TextBox>
                            </td>
                        </tr>
                        <tr id="sexo">
                            <td>
                                <asp:Label ID="lblSexo" runat="server" Text="Sexo:"></asp:Label>
                            </td>
                            <td>
                                <asp:RadioButton ID="rdbFeminino" runat="server" Text="Feminino" AutoPostBack="true" Checked="true" oncheckedchanged="rdbFeminino_CheckedChanged"/> 
                                <asp:RadioButton ID="rdbMasculino" runat="server" Text="Masculino" AutoPostBack="true" oncheckedchanged="rdbMasculino_CheckedChanged" />
                            </td>                
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblTelefone" runat="server" Text="Telefone:"></asp:Label>
                            </td>
                            <td>
                                <ucNumericTextBox:numeric ID="txtTelefone" runat="server" MaxLength="10" Onkeypress="return isNumberKey(event)"/>   
                            </td>
                        </tr>
                        <tr id="responsavel">
                            <td>
                                <asp:Label ID="lblResponsavel" runat="server" Text="Responsável:"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtResponsavel" runat="server" MaxLength="45"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblEndereco" runat="server" Text="Endereço:"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtEndereco" runat="server" MaxLength="100"></asp:TextBox>
                            </td>
                        </tr>            
                        <tr>
                            <td>
                                <asp:Label ID="lblCEP" runat="server" Text="CEP:"></asp:Label>
                            </td>
                            <td>
                                <ucNumericTextBox:numeric ID="txtCEP" runat="server" MaxLength="8" Onkeypress="return isNumberKey(event)"/>   
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblCidade" runat="server" Text="Cidade:"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtCidade" runat="server" MaxLength="20"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblEmail" runat="server" Text="E-mail:"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="txtEmail" runat="server" MaxLength="50"></asp:TextBox>
                            </td>
                        </tr>
                    </table>                    
                </div>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>